//
//  HEHealthAlarmModel.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/12/31.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEHealthAlarmModel.h"

@implementation HEHealthAlarmModel

- (id)mutableCopyWithZone:(NSZone *)zone {
    HEHealthAlarmModel *person = [[HEHealthAlarmModel allocWithZone:zone] init];
    person.create_date = self.create_date;
    person.alarm_week = self.alarm_week;
    person.alarm_title = self.alarm_title;
    person.usid = self.usid;
    person.alarm_express = self.alarm_express;
    person.alarm_time = self.alarm_time;
    person.alarm_state = self.alarm_state;
    person.jobid = self.jobid;
    person.inst_id = self.inst_id;
    person.alarm_content = self.alarm_content;
    person.notice_guardian = self.notice_guardian;
    person.alarm_type = self.alarm_type;
    return person;
}

- (NSString *)Khours {
    if (!_Khours) {
        _Khours = [NSDate timestampToDate:_create_date formaterMode:NSDateFormaterModeTimeMinute];
    }
    return _Khours;
}

- (NSString *)KAllWeak {
    if (!_KAllWeak) {
        
        if ([DYTools isBlankString:_alarm_week]) {
            return nil;
        }
        
        NSArray *arr = [_alarm_week componentsSeparatedByString:@","];
        NSMutableArray *weaks = @[].mutableCopy;
        NSArray *weakDay = @[@"周一", @"周二", @"周三", @"周四", @"周五", @"周六", @"周日"];
        for (NSString *weak in arr) {
            NSInteger i = [weak integerValue] - 1;
            [weaks addObject:weakDay[i]];
        }
        if (weaks.count == weakDay.count) {
            _KAllWeak = @"每天";
        }else {
            _KAllWeak = [weaks componentsJoinedByString:@","];
        }
    }
    return _KAllWeak;
}

@end
